<?php
/**
 * Created by PhpStorm.
 * User: LiuJiaJun
 * Date: 2018/11/18
 * Time: 21:42
 */

namespace app\storage\controller;

use app\storage\service\CommonService;
use cmf\controller\AdminBaseController;
use app\storage\model\OutflowModel;
use think\Request;
/**
 *出库明细查询
 *Class OutflowController
 * @package app\storage\controller
 */
class OutflowController extends AdminBaseController
{
    protected $outflowModel;
    private $commonService;
    use \app\storage\util\Common;

    public function __construct(CommonService $commonService, OutflowModel $outflowModel,Request $request = null)
    {
        parent::__construct($request);
        $this->outflowModel = $outflowModel;
        $this->commonService = $commonService;

    }

    /**
     *调用出库明细视图
     */
    public function index()
    {
        $storageUuid = input('storageUuid');
        $storageInfo = $this->commonService->get_assign_storage($storageUuid);
        $assign['storageUuid'] = $storageUuid;
        $assign['storageInfo'] = $storageInfo;
        $this->assign($assign);
        return $this->fetch('index');
    }

    public function getOutflow()
    {
        $where = $this->getWhere();
        $result = $this->outflowModel->getOutflow($where);
        return json($result);
    }
}